Join in to 𝗟𝗘𝗔𝗥𝗡 𝗮𝗻𝗱 𝗘𝗔𝗥𝗡 Referral Program 𝘄𝗶𝘁𝗵 us.Login to get the code.

    Raj26-June-2025

    How to Master SQL from Basic to Advance in 45 Days

    Overview:
    This comprehensive 45-day SQL roadmap is designed to take you from beginner to advanced level with real-world problem-solving, interview preparation, and project-based learning. Whether you're aiming for a role in data analytics, engineering, or backend development, this structured plan ensures mastery of SQL concepts with hands-on practice and curated interview questions.

    What’s Inside:

    • Week-by-Week Learning Path: From SELECT basics to advanced Window Functions and CTEs.

    • 21+ Interview Questions Per Week: Covering theoretical and practical scenarios frequently asked in top tech interviews.

    • Sample Problems & Projects: Real-world use cases to build proficiency and confidence.

    • Optimization Techniques: Includes query tuning, indexing, and execution plan analysis.

    • Capstone Projects: Dashboard creation, user churn analysis, and sales insights.

    Perfect for self-learners, job seekers, and students preparing for FAANG-level interviews or aspiring to become data professionals.

    How to Master SQL from Basic to Advance in 45 Days

    A Step-by-Step Roadmap with Interview Questions, Tips, and Sample Problems

    Introduction

    Þ   SQL (Structured Query Language) is the cornerstone of data-driven decision-making. Whether you're building dashboards, writing ETL pipelines, or preparing for a data role interview, mastering SQL is essential.

    Þ   This guide outlines a 45-day intelligent roadmap to help you progress from beginner to advanced SQL fluency, along with interview questions and sample problems at every step.

    45-Day SQL Roadmap:

    Week

    Focus Area

    Key Concepts

    Deliverables

     1

    SQL Basics

    SELECT, WHERE, ORDER BY, LIMIT, DISTINCT

    Solve 15 basic SELECT queries

    2

    Joins & Relationships

    INNER JOIN, LEFT/RIGHT JOIN, SELF JOIN

    Join-based exercises and mini-ERD project

    3

    Aggregations & Grouping

    GROUP BY, HAVING, COUNT, SUM, AVG

    Aggregation-based queries, sales report

    4

    Subqueries & Set Ops

    Subqueries, IN/EXISTS, UNION, INTERSECT

    Write layered queries and nested logic

    5

    Advanced SQL

    CTEs, Window Functions, CASE, RANK()

    Solve 10 FAANG-style SQL questions

    6

    Optimization & Projects

    Indexing, EXPLAIN, Dashboards, Mock Interviews

    Build a SQL project + mock test rounds

     
    Important Interview Questions:

    Week 1: SQL Basics

    1. What is SQL?
    2. What is the difference between WHERE and HAVING?
    3. What does SELECT DISTINCT do?
    4. How does LIMIT work?
    5. What are data types in SQL?
    6. Difference between NULL and 0?
    7. What is the default sorting in ORDER BY?
    8. How to fetch top N records?
    9. What’s the difference between = and LIKE?
    10. What are wildcards?
    11. Explain BETWEEN and IN?
    12. What is a primary key?
    13. How does SQL handle case sensitivity?
    14. What is an alias in SQL?
    15. How to concatenate two columns?
    16. What is IS NULL vs = NULL?
    17. Can you use WHERE with aggregate functions?
    18. How do you write comments in SQL?
    19. How to avoid duplicates in output?
    20. What is a Cartesian Product?
    21. What is the use of AS keyword?

     

    Week 2: Joins

    1. What is a JOIN?
    2. Difference between INNER and LEFT JOIN
    3. What is a RIGHT JOIN?
    4. When do we use FULL OUTER JOIN?
    5. What is a SELF JOIN?
    6. What is a CROSS JOIN?
    7. How does JOIN work internally?
    8. Can we JOIN more than 2 tables?
    9. What is a composite JOIN condition?
    10. Difference between JOIN and UNION
    11. What is a foreign key?
    12. Use case of joining tables without a common key?
    13. How to write JOINs using aliases?
    14. What happens if JOIN condition is missing?
    15. How does SQL optimize JOINs?
    16. Best practices for writing JOINs?
    17. Difference between ON and USING
    18. How to handle NULLs in JOINs?
    19. What is a semi-join?
    20. What is an anti-join?
    21. Explain a scenario using multiple JOINs?

     

    Week 3: Aggregations & Grouping

    1. What is GROUP BY?
    2. Why do we use HAVING?
    3. Difference between WHERE and HAVING
    4. How do aggregate functions work?
    5. What is the use of COUNT(*)?
    6. How to get AVG salary per department?
    7. What happens if we skip GROUP BY in aggregate query?
    8. What is the use of MIN() and MAX()?
    9. How to group by multiple columns?
    10. What is roll-up and cube (if supported)?
    11. Can we use aggregate inside WHERE?
    12. How do you calculate percentage from aggregate?
    13. Real-time use cases of aggregation
    14. How to filter group-based conditions?
    15. Difference between COUNT and COUNT(DISTINCT)
    16. How to calculate running totals?
    17. What is the purpose of HAVING 1=1?
    18. How to sort groups based on aggregation?
    19. How does GROUP BY affect performance?
    20. Use GROUP BY with JOIN
    21. What are the limitations of GROUP BY?

     

    Week 4: Subqueries and Set Operations

    1. What is a subquery?
    2. Where can subqueries be used?
    3. Difference between correlated and non-correlated subqueries
    4. What is IN, EXISTS, and NOT EXISTS?
    5. Use case of subquery in SELECT
    6. Subquery vs JOIN
    7. Performance differences between JOIN and subquery
    8. What is ANY, SOME, ALL?
    9. Nesting levels allowed in your DBMS?
    10. What is a derived table?
    11. Can we update using subqueries?
    12. How does subquery work inside WHERE?
    13. Difference between UNION and UNION ALL
    14. When to use INTERSECT?
    15. What is the use of EXCEPT?
    16. Set operations syntax across DBMS
    17. Order of execution: subqueries vs outer query
    18. Handling NULL in subqueries
    19. Top N per group using subquery
    20. How to rewrite subquery as JOIN?
    21. Pitfalls in using deeply nested subqueries

     

    Week 5: Advanced SQL

    1. What is a CTE?
    2. Difference between CTE and Subquery
    3. What are Window Functions?
    4. Syntax for RANK(), DENSE_RANK(), ROW_NUMBER()
    5. Use case for LAG() and LEAD()
    6. Real-time application of window functions
    7. How does PARTITION BY work?
    8. What is ORDER BY inside OVER()?
    9. Difference between ROW_NUMBER() and RANK()
    10. What is a CASE expression?
    11. Nested CASE usage
    12. What is COALESCE()?
    13. How to pivot/unpivot data?
    14. Explain recursive CTE
    15. How to calculate moving average?
    16. What is NULLIF()?
    17. Difference between NVL() and ISNULL()
    18. How to handle duplicates with window functions?
    19. Window function performance implications
    20. Ranking top-N per category
    21. Use of FILTER clause in aggregation (if supported)

    Week 6: Optimization & Projects

    1. What is indexing in SQL?
    2. How does indexing speed up queries?
    3. What is a clustered vs non-clustered index?
    4. How to view the execution plan?
    5. What is EXPLAIN keyword?
    6. How to identify slow SQL queries?
    7. What is query cost?
    8. How to avoid full table scans?
    9. What is normalization?
    10. What are the normal forms?
    11. What is denormalization?
    12. Query optimization tips
    13. What is a materialized view?
    14. Temporary tables vs CTE
    15. How to use EXISTS to improve performance?
    16. What is the difference between logical and physical plans?
    17. Real-time example of indexing benefit
    18. Pitfalls of over-indexing
    19. How to tune GROUP BY + JOIN query?
    20. Project scenario: user churn report
    21. Project scenario: sales dashboard

    Sample Problems for Each Week

    Week 1: SQL Basics

    • Problem 1: Select names of all employees from the employee table.
    • Problem 2: Retrieve products priced above $100 sorted in descending order.
    • Problem 3: Find unique cities from a customer table.
    • Hint: Practice SELECT, WHERE, DISTINCT, ORDER BY, and LIMIT

    Week 2: Joins & Relationships

    • Problem 1: List customers and their orders using INNER JOIN.
    • Problem 2: Show all customers with or without orders using LEFT JOIN.
    • Problem 3: Retrieve employee-manager pairs using SELF JOIN.
    • Hint: Understand join conditions and relational schema design.

    Week 3: Aggregations & Grouping

    • Problem 1: Find total sales per region.
    • Problem 2: Show customers who placed more than 5 orders.
    • Problem 3: Average product price per category.
    • Hint: Use GROUP BY, HAVING, COUNT, SUM, AVG.

    Week 4: Subqueries and Set Operations

    • Problem 1: Select customers who didn’t place any orders.
    • Problem 2: Find products that are cheaper than the average price.
    • Problem 3: List common employee IDs from two departments using INTERSECT.
    • Hint: Use subqueries inside SELECT and WHERE, and practice UNION/EXCEPT.

    Week 5: Advanced SQL

    • Problem 1: Rank employees by salary within each department.
    • Problem 2: Display each customer’s previous order date using LAG().
    • Problem 3: Create a CTE to calculate total sales and use in main query.
    • Hint: Practice CTE, window functions (OVER), and CASE expressions.

    Week 6: Optimization & Projects

    • Problem 1: Optimize a slow query that joins large tables and groups by.
    • Problem 2: Create an EXPLAIN plan for a sales report query.
    • Problem 3: Build a dashboard-ready query that shows weekly revenue by category.
    • Hint: Focus on EXPLAIN, indexing, and efficient SQL design.